# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ndpi
_name=nDPI
pkgver=4.14
pkgrel=1
epoch=1
pkgdesc='Open and Extensible GPLv3 Deep Packet Inspection Library.'
arch=('x86_64' 'aarch64')
url='https://github.com/ntop/nDPI'
depends=('libpcap')
makedepends=('json-c' 'libmaxminddb' 'libpcap' 'numactl' 'pcre2' 'rrdtool')
license=('GPL-3.0-or-later')
source=("https://github.com/ntop/$_name/archive/$pkgver.tar.gz")
sha512sums=('f7e24289aa04e19bc357c29ba00ca7d27aefcd2faf51ddf2f526b4c4d4fefd0ded33dd8e60245c0d8772b3a870304d3dda2c40f3d5ee4382342889741f122146')

build() {
  cd "$_name-$pkgver"

  ./autogen.sh

  ./configure --prefix=/usr --with-pic --sbindir=/usr/bin

  make
}

package() {
  cd "$_name-$pkgver"

  make DESTDIR="$pkgdir" install

  # dirt temp hack to circumvent the error from xplico search for header files
  # in /usr/include/libndpi ...
  mkdir -p "$pkgdir/usr/include/libndpi"
  cp -a src/include/*.h "$pkgdir/usr/include/libndpi"

  rm -rf "$pkgdir/usr/sbin"
}

